/*
 * @Description: 
 * @Date: 2023-06-09 17:14:32
 * @LastEditTime: 2023-06-09 17:24:55
 * @FilePath: \api_serverc:\Users\Lenovo\Desktop\api_serve_uni\minmetype\index.js
 */
exports.limitedFileType = function (currentType, requireType) {
  //大多数的文件类型映射数组，(不全如有需要可自行添加)
  const collectionType = {
    xls: 'application/vnd.ms-excel',
    xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
    doc: 'application/msword',
    docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    pdf: 'application/pdf',
    ppt: 'application/vnd.ms-powerpoint',
    pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
    png: 'image/png',
    gif: 'image/gif',
    jpeg: 'image/jpeg',
    jpg: 'image/jpeg',
    MP3: 'audio/mpeg',
    MP4: 'video/mp4',
    mp3: 'audio/mpeg',
    mp4: 'video/mp4',
    html: 'text/html',
    csv: 'text/csv',
    txt: 'text/plain',
  }
  let requireTypeList = requireType.map(_ => collectionType[_]);//形参对应的数组集合
  if (requireTypeList.includes(currentType)) {
    return true;
  } else {
    return false
  }
}